package com.special.threademo.requests151demo;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class SelcectGetDeclared {
    public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {

        String method = "doStuff";
        /**
         * get all method
         */
       // Method declaredMethod = Foo.class.getDeclaredMethod(method);
        /**
         * get public method
         */
       Method method1 = Foo.class.getMethod("doStuff");
         // 是否需要进行安全检查的设置限制！
        System.out.println(method1.isAccessible());
        System.out.println(method1.invoke(new Foo()));
        //System.out.println(method1);

    }

    private static final int liu = 688;
    public static class Foo {
       public final void doStuff() {
           System.out.println("do stuff");
        }
    }
}
